/*
 * Created by Jaren at 2022/7/19 16:50
 */
import 'package:inmotion_protocol/base/base_message.dart';
import 'package:inmotion_protocol/base/file/file_manager.dart';
import 'package:inmotion_protocol/base/protocol.dart';
import 'package:inmotion_protocol/common/log_file_manager.dart';
import 'package:inmotion_protocol/common/vehicle_info.dart';
import 'dart:io';

import 'package:inmotion_protocol/lorin/file/lorin_file_manager.dart';

class LorinLogFileManager extends LogFileManager {
  LorinLogFileManager(Protocol<IMessage> protocol) : super(protocol);

  @override
  IFileManager createFileDownloadManager(LogConfig config) {
    return protocol.createFileDownloadManager(config);
  }

  @override
  LogConfig createLogConfig(String localFilePath, {int? target, ProductProperty? productProperty}) {
    return LorinLogFileConfig(IFileManager.openFileTypeReadOnly, "2:/log.bin", target!, File(localFilePath));
  }
}

class LorinLogFileConfig extends LogConfig implements LorinFileManagerConfig {
  @override
  int openType;

  @override
  String remoteFilename;

  @override
  int target;

  LorinLogFileConfig(this.openType, this.remoteFilename, this.target, File localFile) {
    this.localFile = localFile;
  }
}
